/*
 * @Author: fengweicong 75202172+fengweicong@users.noreply.github.com
 * @Date: 2022-06-27 08:06:45
 * @LastEditors: fengweicong 75202172+fengweicong@users.noreply.github.com
 * @LastEditTime: 2022-07-16 15:40:16
 * @FilePath: \B2B\ebuy\src\api\index.js
 * @Description: 
 * 
 * Copyright (c) 2022 by fengweicong 75202172+fengweicong@users.noreply.github.com, All Rights Reserved. 
 */
//当前这个模块：API进行统一管理
import request from '@/api/request';

// 发布供应 注：添加成功返回id
export const publishSupply = (obj)=>request({url: 'product',method: 'POST',data: obj});
// 获取全部供应
export const getSupply = ()=>request({url: 'product',method: 'GET'});
// 获取一个供应
export const getOneSupply = (id)=>request({url: `product/${id}`,method: 'GET'});
// 删除供应
export const deleteSupply = (id)=>request({url: `product/${id}`,method: 'DELETE'});
// 修改供应
export const modifySupply = (obj, id)=>request({url: `product/${id}`,method: 'PUT', data: obj});


// 添加规格 注：添加成功返回id
export const addSpecification = (obj)=>request({url: 'product_specification',method: 'POST',data: obj});
// 获取全部规格
export const getSpecification = ()=>request({url: 'product_specification',method: 'GET'});
// 获取一个订单
export const getOneSpecification= (sid)=>request({url: `product_specification/${sid}`,method: 'GET'});
// 删除规格
export const deleteSpecification = (id)=>request({url: `product_specification/${id}`,method: 'DELETE'});
// 修改规格
export const modifySpecification = (obj, id)=>request({url: `product_specification/${id}`,method: 'PUT', data: obj});

// 提交订单 注：添加成功返回id
export const summitProductOrder = (obj)=>request({url: 'product_order',method: 'POST',data: obj});

// 获取全部订单
export const getProductOrder = ()=>request({url: 'product_order',method: 'GET'});
// 获取一个订单
export const getOneProductOrder = (oid)=>request({url: `product_order/${oid}`,method: 'GET'});
// 删除订单
export const deleteProductOrder = (id)=>request({url: `product_order/${id}`,method: 'DELETE'});
// 修改订单
export const modifyProductOrder = (obj, id)=>request({url: `product_order/${id}`,method: 'PUT', data: obj});

// 获取全部卖家
export const getSupplier = ()=>request({url: 'supplier',method: 'GET'});
// 获取一个卖家
export const getOneSupplier = (sid)=>request({url: `supplier/${sid}`,method: 'GET'});
// 添加卖家 注：添加成功返回id
export const addSupplier = (obj)=>request({url: 'supplier',method: 'POST',data: obj});
// 修改卖家 
export const modifySupplier = (obj, id)=>request({url: `supplier/${id}`,method: 'PUT',data: obj});

// 获取全部买家
export const getPurchaser = ()=>request({url: 'purchaser',method: 'GET'});
// 获取一个买家
export const getOnePurchaser = (id)=>request({url: `purchaser/${id}`,method: 'GET'});
// 添加卖家 注：添加成功返回id
export const addPurchaser = (obj)=>request({url: 'purchaser',method: 'POST',data: obj});
// 修改买家
export const modifyPurchaser = (obj, id)=>request({url: `purchaser/${id}`,method: 'PUT',data: obj});

// 获取全部账号
export const getLoginAccount = ()=>request({url: 'login_account', method: 'GET'});
// 获取一个账号
export const getOneLoginAccount = (id)=>request({url: `login_account/${id}`,method: 'GET'});
// 删除账号
export const deleteLoginAccount = (id)=>request({url: `login_account/${id}`,method: 'DELETE'});
// 添加账号 注：添加成功返回id
export const addLoginAccount = (obj)=>request({url: 'login_account',method: 'POST',data: obj});
// 修改账号
export const modifyLoginAccount = (obj, id)=>request({url: `login_account/${id}`,method: 'PUT',data: obj});

//添加收货地址 注：添加成功返回id
export const addDeliveryAddress = (obj)=>request({url: 'delivery_address',method: 'POST',data: obj});
//修改收货地址 
export const modifyDeliveryAddress = (obj, id)=>request({url: `delivery_address/${id}`,method: 'PUT',data: obj});
//获取全部收货地址 
export const getDeliveryAddress = ()=>request({url: 'delivery_address',method: 'GET'});
//获取一个收货地址 
export const getOneDeliveryAddress = (aid)=>request({url: `delivery_address/${aid}`,method: 'GET'});
// 删除收获地址
export const deleteDeliveryAddress = (id)=>request({url: `delivery_address/${id}`,method: 'DELETE'});

// 添加一张产品图片
export const addProductPhotos = (obj)=>request({url: 'product_photos',method: 'POST', data: obj})
// 获取全部产品图片
export const getProductPhotos = ()=>request({url: 'product_photos', method: 'GET'});
// 删除产品图片
export const deleteProductPhotos = (id)=>request({url: `product_photos/${id}`,method: 'DELETE'});

// 添加一张供应商图片
export const addSupplierPhotos = (obj)=>request({url: 'supplier_photos',method: 'POST', data: obj})
// 获取全部供应商图片
export const getSupplierPhotos = ()=>request({url: 'supplier_photos', method: 'GET'});
// 删除供应商图片
export const deleteSupplierPhotos = (id)=>request({url: `supplier_photos/${id}`,method: 'DELETE'});

// 添加一条动态
export const addSupplierRecent = (obj)=>request({url: 'supplier_recent',method: 'POST', data: obj})
// 获取全部动态
export const getSupplierRecent = ()=>request({url: 'supplier_recent', method: 'GET'});
// 删除动态
export const deleteSupplierRecent = (id)=>request({url: `supplier_recent/${id}`,method: 'DELETE'});

// 添加一张动态图片
export const addSupplierRecentPhotos = (obj)=>request({url: 'supplier_recent_photos',method: 'POST', data: obj})
// 获取全部动态图片
export const getSupplierRecentPhotos = ()=>request({url: 'supplier_recent_photos', method: 'GET'});

// 添加一条评价
export const addProductComment = (obj)=>request({url: 'product_comment',method: 'POST', data: obj})
// 获取全部评价
export const getProductComment = ()=>request({url: 'product_comment', method: 'GET'});
// 删除评价
export const deleteProductComment = (id)=>request({url: `product_comment/${id}`,method: 'DELETE'});
// 修改评价
export const modifyProductComment = (obj, id)=>request({url: `product_comment/${id}`,method: 'PUT',data: obj});

// 添加一张评价图片
export const addProductCommentPhotos = (obj)=>request({url: 'product_comment_photos',method: 'POST', data: obj})
// 获取全部评价图片
export const getProductCommentPhotos = ()=>request({url: 'product_comment_photos', method: 'GET'});

// 添加一条收藏
export const addFavorite = (obj)=>request({url: 'favorite',method: 'POST', data: obj})
// 获取全部收藏
export const getFavorite = ()=>request({url: 'favorite', method: 'GET'});
// 删除收藏
export const deleteFavorite = (id)=>request({url: `favorite/${id}`,method: 'DELETE'});